Method and system for forecasting real-time well mass flow in green energy generation utilizing digital twin technology

ABSTRACT

A method of managing a well system includes: obtaining, by a digital twin manager and based on a predetermined monitoring criterion, well mass flow data of the well system; obtaining, by the digital twin manager, modeled well mass flow data for the well system using a physics-based model; training, by the digital twin manager, a physics constrained machine learning model using one or more machine learning algorithms based on the well mass flow data and the modeled well mass flow data as inputs; obtaining, by the digital twin manager, real-time well mass flow data of the well system; outputting, by the digital twin manager, predicted well mass flow data using the real-time well mass flow data and the trained physics constrained machine learning model; and transmitting, by the digital twin manager, a command to the well system that adjusts a well operation based on the predicted well mass flow data.

BACKGROUND

In the field of green energy generation, techniques for efficientlygathering natural resources are of great importance for maximizingproduction while minimizing environmental impact and risks. Aphysics-based model is developed to replicate the well mass flow of afield well system with a good degree of accuracy. However, one of themain limits of the physics-based model is the capability to replicateaspects of the dynamics behavior of the well subsystem that aredifficult to model by a lumped-parameter approach. To improve theeffectiveness of predicting real-time well mass flow according to thelumped-parameter model, a machine learning (ML) model is developed in adigital twin for the well system of interest based on information offield well measurements under normal operating conditions.

SUMMARY

In general, embodiments of the invention relate to a method of managinga well system including: obtaining, by a digital twin manager and basedon a predetermined monitoring criterion, well mass flow data of the wellsystem; obtaining, by the digital twin manager, modeled well mass flowdata for the well system using a physics-based model; training, by thedigital twin manager, a physics constrained machine learning model usingone or more machine learning algorithms based on the well mass flow dataand the modeled well mass flow data as inputs; obtaining, by the digitaltwin manager, real-time well mass flow data of the well system;outputting, by the digital twin manager, predicted well mass flow datausing the real-time well mass flow data and the trained physicsconstrained machine learning model; and transmitting, by the digitaltwin manager, a command to the well system that adjusts a well operationbased on the predicted well mass flow data.

In addition, embodiments of the invention relate to a well systemincluding: a well site; a physics-based modeling server that outputsmodeled well mass flow data for the well site based on a physics-basedmodel; and a digital twin manager, coupled to the physics-based modelingserver and the well site, that includes a processor. The digital twinmanager: obtains, based on a predetermined monitoring criterion, wellmass flow data of the well site; obtains modeled well mass flow data forthe well site using the physics-based model; trains a physicsconstrained machine learning model using one or more machine learningalgorithms based on the well mass flow data and the modeled well massflow data as inputs; obtains real-time well mass flow data of the wellsite; outputs predicted well mass flow data using the real-time wellmass flow data and the trained physics constrained machine learningmodel; and transmits a command to the well site that adjusts a welloperation based on the predicted well mass flow data.

In addition, embodiments of the invention relate to a non-transitorycomputer readable medium storing instructions executable by a computerprocessor. The instructions comprise functionality for: obtaining wellmass flow data of a well system based on a predetermined monitoringcriterion; obtaining modeled well mass flow data for the well systemusing a physics-based model; training a physics constrained machinelearning model using one or more machine learning algorithms based onthe well mass flow data and the modeled well mass flow data as inputs;obtaining real-time well mass flow data of the well system; outputtingpredicted well mass flow data using the real-time well mass flow dataand the trained physics constrained machine learning model; andtransmitting a command to the well system that adjusts a well operationbased on the predicted well mass flow data.

Other aspects and advantages of the claimed subject matter will beapparent from the following description and the appended claims.

BRIEF DESCRIPTION OF DRAWINGS

Specific embodiments of the disclosed technology will now be describedin detail with reference to the accompanying figures. Like elements inthe various figures are denoted by like reference numerals forconsistency.

FIG. 1 shows a system in accordance with one or more embodiments.

FIG. 2 shows an example in accordance with one or more embodiments.

FIG. 3 shows a flowchart in accordance with one or more embodiments.

FIG. 4 shows an example in accordance with one or more embodiments.

FIGS. 5A and 5B show examples in accordance with one or moreembodiments.

FIG. 6 shows a computer system in accordance with one or moreembodiments.

DETAILED DESCRIPTION

In the following detailed description of embodiments of the disclosure,numerous specific details are set forth in order to provide a morethorough understanding of the disclosure. However, it will be apparentto one of ordinary skill in the art that the disclosure may be practicedwithout these specific details. In other instances, well-known featureshave not been described in detail to avoid unnecessarily complicatingthe description.

In general, embodiments of the disclosure include systems and methodsfor a digital twin of a well system of interest to predict well massflow by applying a Levenberg-Marquardt algorithm in a physicsconstrained machine learning (ML) workflow. By improving prediction ofwell mass flow of a well system, a larger set of features and moreaccurate control information (e.g., maintenance periods may be predictedand scheduled based on identified declines or transient features in wellmass flow performance; production equipment may be regulated to mitigatesystem faults/failures or avoid costly emergency shut-down conditions)may be extracted from the digital twin of the well system. As a result,production facilities and well systems for green energy generation maybe operated with higher efficacy.

A well system may include one or more interconnected subsystems thatinclude a compressor subsystem and a sales header subsystem. The digitaltwin of the well system of interest is applied to generate a model torepresent a well system and automatically emulate real-time dynamicsbehavior (e.g., well mass flow) for monitoring and predictivemaintenance purposes based on a physics-based model and a real-timefield dynamics behavior of a well system of interest. For example, thedigital twin for the well system of interest applies the physicsconstrained machine learning workflow to reduce prediction error betweenthe predicted well mass flow and the obtained well mass flow from afield well system of interest. As another example, the digital twin forthe well system of interest may assess the predicted well mass flow tomonitor normal operations of the well system and/or predict systemfaults, system failures, and system shut-downs.

Furthermore, the digital twin of the well system of interest may use aLevenberg-Marquardt algorithm to solve a least-squares curve fittingproblem which has a misfit function which includes a well mass flowprediction error (e.g., integral square error (ISE), mean error (ME),normalized ISE, and normalized ME) based on the difference between thewell mass flow obtained using a physics constrained machine learningmodel and acquired well mass flow data from the well system of interest.One or more embodiments apply a Levenberg-Marquardt algorithm within adigital twin of the well system of interest to improve the convergencetime of a ML algorithm and the accuracy of non-linear dynamics of thewell system of interest. In particular, the Levenberg-Marquardtalgorithm interpolates between a Gauss-Newton algorithm and a steepestdescend algorithm. The Levenberg-Marquardt algorithm applies a steepestdescend algorithm when the misfit function is complex for a model at aniteration and approximately performs a Gauss-Newton algorithm when themisfit function for a model at an iteration is close to a quadraticapproximation. Thus, the Levenberg-Marquardt algorithm provides a fastand stable numerical solution to non-linear least-squares curve fittingproblem to predict real-time well mass flow based on the well mass flowobtained using a physics-based model and the acquired well mass flowfrom the well system of interest.

FIG. 1 shows a system in accordance with one or more embodiments. Asshown in FIG. 1 , a digital twin (100) for a well system of interest mayinclude a digital twin manager (160), a well system comprising one ormore well sites (e.g., well site A (110), well site B (120)), and/orvarious network elements (not shown). A well site (e.g., well site A(110), well site B (120)) may include a well subsystem (e.g., acompressor subsystem or a sales header subsystem). A well subsystem isdescribed in further detail below with respect to FIG. 4 and theaccompanying description. In some embodiments, the digital twin manager(160) obtains one or more types of well data (e.g., well data A (191),well data B (192)), such as well mass flow data (e.g., well mass flowdata A (111), well mass flow data B (121)), one or more well system data(e.g., data or parameters characterizing well subsystem A (112), wellsubsystem B (122)), and other well activities data stored in a database(e.g., database A (113), database B (123)). Likewise, the digital twinmanager (160) may also obtain user data (137) (e.g., modeled well datafrom one or more physics-based model servers (130)). For example, wellmass flow data A (111) may include measurements of mass flow inkilogram/second (kg/s) for the well subsystem A (112). Modeled well massflow data included in the user data (137) may include measurements ofmass flow in kg/s for one or more well subsystems determined by aphysics-based model server (130) for each well subsystem. As anotherexample, each well subsystem may include information associated with aflow element and a flow meter based on the mass and/or volumetric flowrate, turn-down ratio (e.g., range of flow to be measured), pressure,temperature, and extent of flow surging. Likewise, each well subsystemmay include various safety alerts, conditions at one or more wells(e.g., corresponding to system faults, system failures, systemshut-downs, safety conditions, weather conditions, well conditions,etc.).

In some embodiments, a physics-based model server (130) may be a remoteserver that includes hardware and/or software with functionality fordetermining well mass flow for a well system of interest. For example,the physics-based model server (130) may use one or more simulationengines (134) to apply one or more simulation models (135) to model awell mass flow of a well subsystem and store the modeled well mass flowdata in a database (136) based on user selections (131) obtained from auser device (133) via a user interface (132) for a particular timeperiod. For example, the user device (133) may include hardware and/orsoftware to receive user selections (131) in real-time by interactingwith a user via the user interface (132). Likewise, a remote server maybe a server that communicates to various wells over a network or througha cloud computing environment. The well mass flow data (e.g., well massflow data A (111), well mass flow data B (121)) from the well subsystemsmay be automatically transmitted to the physics-based model server andstored in the database (136).

Furthermore, the digital twin manager (160) may include hardware and/orsoftware with functionality for obtaining a monitoring criterion (161)regarding digital twin activities, well data (e.g., well data (163)),and physics-based well mass flow data (164) (e.g., the modeled well massflow data from the physics-based model server (130)) from data inputs(e.g., user data (137), well data A (191), well data B (192)). Forexample, the digital twin manager (160) acquires the monitoringcriterion (161) by interacting with a user via a user interface (169).In particular, the monitoring criterion may include a threshold limitingthe misfit function based on well mass flow determined by a machinelearning model (e.g., ML models (165)) and field well mass flow obtainedfrom one or more well subsystems. As another example, the digital twinmanager (160) may allow the user to interact with a user device (133) tomodify the monitor criterion (161) to verify the ML model (165) isdesigned as desired and that the performance of the digital twin (100)is set up for predicting real-time events to help to monitor theperformance of one or more field well systems (e.g., well site A (110),well site B (120)). For example, when the misfit function is larger thanthe monitoring criterion (161) (e.g., a value of “50”), the ML model(165) is not desired and a new model may be developed. Thus, the usercan modify the monitoring criterion (161) via the user interface (169)to adjust the ML model (165) and/or the physics-based model (e.g.,simulation models (135)) to improve the performance of the digital twin(100) of the well system.

Keeping with FIG. 1 , in some embodiments, the digital twin manager(160) may include hardware and/or software with functionality fordetermining a predicted well mass flow using a ML algorithm (162) basedon the modeled well mass flow data (e.g., physics-based well mass flowdata (164)) obtained from the physics-based model server (130) andobtained well data (163) from the well system (e.g., well mass flow dataA (111), well mass flow data B (121)). In some embodiments, the digitaltwin manager (160) transmits a command (e.g., command (194), command(195)) to a well site (e.g., well site A (110), well site B (120),respectively) to perform one or more well operations to control wellactivities (e.g., to control well subsystem A (112), well subsystem B(122) and affect well mass flow data A (111), well mass flow data B(121)) and other well activities data stored in a database (e.g.,database B (123)) for the well system. For example, a digital twinmanager (160) may implement a ML model (165) to predict real-time wellmass flow stored in a database (166) based on the obtained well massflow data from the physics-based model server (130) (e.g., physics-basedwell mass flow data (164)) and well data (163) from one or more wells totune a particular monitoring criterion (161) for the well system. Thus,different inputs (e.g., types of data or different data sources) mayprovide the initial setup of a particular monitoring criterion, wherethe data inputs may be customized by a data preprocessing module (168)according to different physics-based models to better arrange amonitoring criterion. Since the digital twin manager (160) isself-maintained on data storage and usage for monitoring and predictivemaintenance purposes , the digital twin manager (160) may requireminimal supervision or human interaction.

In some embodiments, the digital twin manager (160) advises a user abouta regular structure of setting a well monitoring criterion when thelearning process detects a feature that a human might miss due to thecomplexity and amount of data and variables. For example, an advisementmay be a message prompt in a graphical user interface (e.g., userinterface (169)) managed by the digital twin manager (160).

In some embodiments, for example, the digital twin manager (160) appliesone or more ML algorithms (162) (e.g., an artificial neural network) totrain a ML model (165) to determine well mass flow at a well (e.g., wellsite A (110)). Likewise, the digital twin manager (160) includes a modelvalidation module (167) to validate the ML model (165). In someembodiments, a digital twin manager (160) may generate augmented orsynthetic data to produce a large amount of interpreted data fortraining a particular model. Likewise, a ML model (165) may be trainedusing one or more ML algorithms (162).

In some embodiments, a ML model (165) may be trained by using abackpropagation algorithm to train a neural network. A neural networkmay include one or more hidden layers, where a hidden layer includes oneor more neurons. A neuron may be a modelling node or object that isloosely patterned on a neuron of the human brain. In particular, aneuron may combine data inputs with a set of coefficients (i.e., a setof network weights for adjusting the data inputs). These network weightsmay amplify or reduce the value of a particular data input, therebyassigning an amount of significance to various data inputs for a taskbeing modeled. Through machine learning, a neural network may determinewhich data inputs should receive greater priority in determining one ormore specified outputs of the neural network. Likewise, these weighteddata inputs may be summed such that this sum is communicated through aneuron’s activation function to other hidden layers within the neuralnetwork. As such, the activation function may determine whether and towhat extent an output of a neuron progresses to other neurons where theoutput may be weighted again for use as an input to the next hiddenlayer.

As another example, in some embodiments, a ML model (165) may be trainedby a Levenberg-Marquardt algorithm. The training data may includehistorical events obtained from a physics-based model server (130) andwell data (e.g., well data A (191), well data B (192)) from a wellsystem of interest. A digital twin manager (160) may continue to trainthe ML model (165) by adjusting the physics-based model server (130) tomore accurate model the physics-based well mass flow data (164). Thus,the ML model (165) predicts the real-time well mass flow of the wellsystem of interest because the learning process of the algorithm issetup for monitoring and predictive maintenance purposes as desired.

Furthermore, the digital twin manager (160) may use aLevenberg-Marquardt algorithm to solve non-linear least-squares fittingproblem to minimize the misfit function based on the difference betweenthe modeled well mass flow obtained using a physics-based model and theacquired well mass flow from the well system of interest. TheLevenberg-Marquardt algorithm is a combination of the steepest descentmethod and the Gauss-Newton method. In the steepest descent method, themisfit function is minimized by seeking a solution in the steepestdescent direction. In the Gauss-Newton method, the misfit function isminimized by seeking a solution assuming the misfit function is locallyquadratic. For example, the Levenberg-Marquardt algorithm is more like asteepest descent method when the model is far from the optimal model andthe misfit function is complex with many local minimums. On the otherhand, the Levenberg-Marquardt algorithm is more like a Gauss-Newtonmethod to speed up convergence when the model is close to the optimalmodel and the misfit function is close a quadratic approximation.

FIG. 2 shows an example of generating a model to determine well massflow data based on the physics-based well mass flow data (i.e., amodeled well mass flow data for the well system) determined by aphysics-based model and the real-time well mass flow data obtained froma well system of interest in accordance with one or more embodiments.The following example is for explanatory purposes only and not intendedto limit the scope of the disclosed technology.

In FIG. 2 , a neural network model (251) is trained using one or morephysics constrained machine learning algorithms (200) for predictingwell mass flow (e.g., predicted well mass flow data (250)). The physicsconstrained machine learning algorithms (200) include aLevenberg-Marquardt algorithm (201). The neural network model (251)obtains physics-based well mass flow data (205) based on a physics-basedmodel and real-time well mass flow data (210) acquired from a wellsystem to determine the predicted outputs represented by the outputlayer consisting of predicted well mass flow data (250). The inputparameters (e.g., physics-based well mass flow data (205), real-timewell mass flow data (210)) are synchronized and preprocessed with aquality control operation (e.g., by the data preprocessing module (168)of the digital twin manager (160)). The predicted well mass flow data(250) may have higher time resolution than the real-time well mass flowdata (210) and may capture non-linear dynamics behavior of the wellsystem or an individual well subsystem. In particular, the neuralnetwork model (251) may predict the well mass flow y(t) at time t basedon the input well mass flow data over a considered horizon d (e.g., avalue of “10” seconds) (Equation 1).

y(t) = f(x(t), x(t − 1), … , x(t − d))

where y(t) is the predicted well mass flow at time t; x(t) is a vectorof input well mass flow from the well system of interest and thephysics-based model; and d is a considered horizon or time delay inseconds.

Furthermore, a physics constrained machine learning algorithm (200) maylearn dynamics behavior data (e.g., well mass flow, well temperature,well pressure) of the well system using real-time dynamics behavior dataof the well system and emulated dynamics behavior data based on thephysics-based model. The goal of the physics constrained machinelearning algorithm (200) requires to correctly define the structure ofthe algorithm, select signals to be considered input and output, andmanipulate available signals in the correct form to match the expectedML output. For example, an autoregressive machine learning algorithmtrains a model using training data which are a set of n time series,such that x(k) ∈ ℝ^(n). Each training data sample contains the values ofdifferent signals at a given time instance. If the training data containonly well mass flow, the physics constrained machine learning algorithm(200) may predict the dynamics behavior of well mass flow. Likewise, ifamong the n different signals composing x we select other dynamicsbehavior data (e.g., well temperature, well pressure) of the wellsystem, the physics constrained machine learning algorithm (200) maypredict a different dynamics behavior (e.g., well temperature, wellpressure) related to a different variable of the well system.

Furthermore, the neural network model (251) may include six hiddenlayers (i.e., hidden layer A (281), hidden layer B (282), hidden layer C(283), hidden layer D (284), hidden layer E (285), hidden layer F(286)), which may be a convolutional layer, a pooling layer, a rectifiedlinear unit (ReLU) layer, a softmax layer, a regressor layer, a dropoutlayer, and/or various other hidden layer types. In some embodiments, thenumber of hidden layers may be greater than or less than six. Thesehidden layers can be arranged in any order as long as they satisfy theinput/output size criteria. Each layer comprises of a set number ofimage filters. The output of filters from each layer is stacked togetherin the third dimension. This filter response stack then serves as theinput to the next layer(s). Furthermore, each hidden layer may befeatured by 20 neurons or any appropriate number of neurons.

In some embodiments, the hidden layers are configured as follows. Thehidden layer A (281) and the hidden layer B (282) may be down-samplingblocks to extract high-level features from the input data set. Thehidden layer D (284) and the hidden layer E (285) may be up-samplingblocks to output the classified or predicted output data set. The hiddenlayer C (283) may perform residual stacking as bottleneck betweendown-sampling blocks (e.g., hidden layer A (281), hidden layer B (282))and up-sampling blocks (e.g., hidden layer D (284), hidden layer E(285)). The hidden layer F (286) may include a softmax layer or aregressor layer to classify or predict a predetermined class or a valuebased on input attributes.

In a convolutional layer, the input data set is convolved with a set oflearned filters that are designed to highlight specific characteristicsof the input data set. A pooling layer produces a scaled down version ofthe output by considering small neighborhood regions and applying adesired operation filter (e.g. min, max, mean, etc.) across theneighborhood. A ReLU layer enhances a nonlinear property of the networkby introducing a non-saturating activation function. One example of sucha non-saturating function is to threshold out negative responses (i.e.,set negative values to zero). A fully connected layer provides ahigh-level reasoning by connecting each node in the layer to allactivation nodes in the previous layer. A softmax layer maps the inputsfrom the previous layer into a value between 0 and 1 or between -1and 1. Therefore, a softmax layer allows for interpreting the outputs asprobabilities and selection of classified facie with highestprobability. In particular, a softmax layer may apply a symmetricsigmoid transfer function to each element of the raw outputsindependently to interpret the outputs as probabilities in the range ofvalues between -1 and 1. A dropout layer offers a regularizationtechnique for reducing network over-fitting on the training data bydropping out individual nodes with a certain probability. A loss layer(e.g., utilized in training) defines a weight dependent cost functionthat needs to be optimized (i.e., bring the cost down toward zero) forimproved accuracy.

In some embodiments, each hidden layer is a combination of aconvolutional layer, a pooling layer, and a ReLU layer in a multilayerarchitecture. For example, each hidden layer (e.g., hidden layer A(281), hidden layer B (282), hidden layer C (283), hidden layer D (284),hidden layer E (285), hidden layer F (286)) has a convolutional layer, apooling layer, and a ReLU layer.

Furthermore, the physics constrained machine learning algorithms (200)may include an activation function in a ReLU layer (e.g., hidden layer F(286)) to calculate the misfit function based on the difference betweenthe predicted well mass flow data (250) and a ground truth (e.g.,real-time well mass flow data (210) obtained from the well system). Insome embodiments, a physics constrained machine learning algorithm (200)may use a simple data split technique to separate the input well massdata (e.g., physics-based well mass flow data (205) and real-time wellmass flow data (210)) used for the training, validation, and testing ofthe physics constrained machine learning models. An example, the datasplit technique may consider 70% of the obtained well mass flow data formodel training (e.g., tuning of the model parameters), 15% of theobtained well mass flow data for validation (e.g., performancevalidation for each different set of model parameters), and 15% of theobtained well mass flow data for testing the final trained model.However, the data split technique may be appropriately adjusted (e.g.,by the user) to prevent over-fitting that results in physics constrainedmachine learning models with limited generalization capabilities (e.g.,models that underperform when predicting unseen sample data).

Furthermore, the physics constrained machine learning algorithms (200)may apply a nested k-fold inner/outer cross-validation to tune andvalidate the optimal parameters of the ML model. In one or moreembodiments, the nested stratified inner/outer cross-validation may be asoftware and/or hardware system that includes functionality to mitigatethe over-fitting problem of the ML model by applying a k-fold innercross-validation and a k-fold outer cross-validation. The k-fold innercross-validation and the k-fold outer cross-validation may havedifferent values of the “k” parameter. In some example embodiments, thenested inner/outer cross-validation defines a plurality of physicsconstrained machine learning algorithms and their corresponding modelsin a grid and evaluates one or more performance metrics of interest(e.g., area under curve (AUC), accuracy, geometric mean, f1 score, meanabsolute error, mean squared error, sensitivity, specificity, etc.) tofind the optimal parameters of the physics constrained machine learningmodel.

While FIGS. 1 and 2 show various configurations of components, otherconfigurations may be used without departing from the scope of thedisclosure. For example, one or more of the individual components shownin FIGS. 1 and 2 may be omitted, repeated, and/or disposed in a locationdifferent than that shown in FIGS. 1 and 2 . Accordingly, the scope ofthe invention should not be limited by the specific arrangement asdepicted in FIGS. 1 and 2 .

FIG. 3 shows a flowchart in accordance with one or more embodiments.Specifically, FIG. 3 describes a general method for determining wellmass flow for a digital twin of a well system in accordance with one ormore embodiments. One or more blocks in FIG. 3 may be performed by oneor more components (e.g., digital twin manager (260)) as described inFIGS. 1 and 2 . While the various blocks in FIG. 3 are presented anddescribed sequentially, one of ordinary skill in the art will appreciatethat some or all of the blocks may be executed in different orders, maybe combined or omitted, and some or all of the blocks may be executed inparallel. Furthermore, the blocks may be performed actively orpassively.

In Block 300, a monitoring criterion is obtained for a digital twin of awell system of interest in accordance with one or more embodiments. Forexample, the digital twin manager may obtain a monitoring criteriondefined by a user via a user interface.

In Block 305, well mass flow data are obtained for one or more wells inaccordance with one or more embodiments. For example, the well mass flowdata may be similar to the well data described above in FIG. 1 and theaccompanying description. As another example, the digital twin managermay obtain the well mass flow data from a database that stores sixmonths of well mass flow data which contain both normal operationconditions and shut-down conditions for the well system of interest.

In Block 310, a physics-based model is determined for the digital twinof the well system using the obtained well mass flow data and themonitoring criterion in accordance with one or more embodiments. In someembodiments, the physics-based model includes various sensors whichdetermine multiple well activities (e.g., well-sand GPU flow resistance,mass flow rate, energy flow rate, density flow rate, temperature*densityflow rate, pressure, temperature, midstream chamber, well head,midstream flow resistance, well check valve, well temperature, reservoirtemperature, reservoir flow restriction, constant volume reservoir,reservoir pressure, etc.) that are required to emulate well mass flowfor the digital twin of the well system of interest. For example, aphysics-based model may be similar to the physics-based model describedbelow with respect to FIG. 4 and the accompanying description.

In Block 315, modeled well mass flow data are determined using thephysics-based model for the digital twin of the well system of interestin accordance with one or more embodiments. For example, a physics-basedmodel server emulates the well mass flow data based on one or more userselections defined by a user via a user interface. As another example,the user may modify the user selections for the physics-based model toadjust the modeled well mass flow based on the predetermined monitoringcriterion.

In Block 320, a physics constrained machine learning model is determinedand validated using a Levenberg-Marquardt algorithm, the obtained wellmass flow data, and the modeled well mass flow data derived from thephysics based model in accordance with one or more embodiments. In someembodiments, the digital twin manager trains a model using one or moreML algorithms (e.g., artificial neural network) to determine real-timewell mass flow for a well system of interest. For example, the digitaltwin manager applies the Levenberg-Marquardt algorithm to train aphysics constrained machine learning model to emulate the behavior ofwell mass flow of the well system of interest. In particular, thedigital twin manager applies the model to predict the well mass flowy(t) at time t based on the input well mass flow data over a consideredhorizon d (e.g., a value of “10” seconds) (Equation 1).

Furthermore, the digital twin manager validates the physics constrainedmachine learning algorithm at Block 320. For example, the digital twinmanager may apply a nested k-fold inner/outer cross-validation to tuneand validate the optimal parameters of the physics constrained machinelearning model. As another example, the digital twin manager mayvalidate the physics constrained machine learning model by using thewell mass flow prediction error (e.g., ISE, ME, normalized ISE,normalized ME) between the predicted well mass flow data based on aphysics constrained machine learning model and the field well mass datafor a well system of interest. ISE measures system performance byintegrating the square of the difference between predicted well massflow determined by the model and the field well mass flow data over afixed interval of time (Equation 2). ME measures average systemperformance by averaging the integral of the absolute value of thedifference between predicted well mass flow determined by the model andthe field well mass flow data over a fixed interval of time (Equation3). Normalized ISE measures the ISE value normalized by the final valueof the ISE by the same physics-based model used by the digital twin ofthe well system (Equation 4). Normalized ME measures the ME valuenormalized by the final value of the ME by the same physics-based modelused by the digital twin of the well system (Equation 5). For example,the physics constrained machine learning model is valid when thenormalized ISE for the physics constrained machine learning model isless than a threshold (e.g., a value of “1”). As another example, thephysics constrained machine learning model is valid when the normalizedME is less than a threshold (e.g., a value of “1”).

ISE(t) = ∫_(t1)^(t)(y(t) − d(t))²dt

$ME = \frac{1}{t2 - t1}{\int_{t1}^{t2}\left| {y(t) - d(t)\left| {dt} \right)} \right)}$

$ISE^{N}(t) = \frac{1}{ISE_{ph - based}\left( {t2} \right)}{\int_{t1}^{t}{\left( {y(t) - d(t)} \right)^{2}dt}}$

$ME^{N} = \frac{1}{\left( {t2 - t1} \right)ME_{ph - based}}{\int_{t1}^{t2}\left| {y(t) - d(t)\left| {dt} \right)} \right)}$

where y(t) is the predicted well mass flow at time t by a physicsconstrained machine learning model; d(t) is the field well mass flow attime t from a well system of interest; ISE(t) is the integral squareerror at time t; ME is the mean error from time t1 to t2; ISEN (t) isthe integral square error at time t normalized by the final valueISE_(ph-based)(t2) of the ISE by the same physics-based model used bythe digital twin of the well system; ME^(N) is the mean error normalizedby the final value ME_(ph-based) of the ME by the same physics-basedmodel used by the digital twin of the well system.

In Block 325, real-time well mass flow data are obtained for one or morewells in accordance with one or more embodiments. For example, the wellmass flow data may be similar to the well data described above in FIG. 1and the accompanying description.

In Block 330, predicted well mass flow data are determined using thetrained physics constrained machine learning model and the obtainedreal-time well mass flow data in accordance with one or moreembodiments. For example, the digital twin manager applies the physicsconstrained machine learning model to emulate the current and/or futurewell mass flow data for a well system of interest (Equation 1).

In Block 335, a determination is made whether the predicted well massflow data matches the field data. For example, the digital twin managerapplies the physics constrained machine learning model to emulate thewell mass flow data at time t for a well system of interest based on apredetermined criterion. When a value of the misfit function is smallerthan a predetermined criterion (e.g., 5% of the initial misfit functionvalue), the predicted well mass flow data using the physics constrainedmachine learning model is determined to match the field data obtainedfrom the well system of interest. As another example, when thedifference between the predicted well mass flow data using the physicsconstrained machine learning model and the field data obtained from thewell system of interest is smaller than a predetermined criterion (e.g.,a value of “50” kg/s), the predicted well mass flow data using thephysics constrained machine learning model is determined to match thefield data obtained from the well system of interest. Where it isdetermined that the predicted well mass flow data using the physicsconstrained machine learning model matches the field data obtained fromthe well system of interest, the process may proceed to Block 340. Whereit is determined that the predicted well mass flow data using thephysics constrained machine learning model does not match the field dataobtained from the well system of interest, the process may proceed toBlock 310 where the physics-based model is adjusted and optimized.

In Block 340, a command is transmitted to adjust various operationsbased on the predicted well mass flow data in accordance with one ormore embodiments. For example, the digital twin manager sends a commandto the well system of interest to maintain normal operation based on thepredicted well mass flow data using the physics constrained machinelearning model. As another example, the digital twin manager sends acommand to the well system of interest to apply an operation to resolvesystem faults, system failures, and system shut-downs based on thepredicted well mass flow data using the physics constrained machinelearning model.

FIG. 4 provides an example of a physics-based model in accordance withone or more embodiments. The following example is for explanatorypurposes only and not intended to limit the scope of the disclosedtechnology. While the various blocks in FIG. 4 are presented anddescribed sequentially, one of ordinary skill in the art will appreciatethat some or all of the blocks may be organized in different orders, maybe combined or omitted, and some or all of the blocks may be repeated inserial or parallel. Accordingly, the scope of the invention should notbe limited by the specific arrangement as depicted in FIG. 4 .

In FIG. 4 , a physics-based model includes an initial stage (401), asecond stage (402), a connection branch (403), and a terminal stage(404). Using the physics-based model, the digital twin managerdetermines a modeled well mass flow data based on the underlying datainputs from the well measurements in a well subsystem. Each of thesestages is described in further detail below.

In the physics-based model, the initial stage (401) includes acontrolled reservoir module (i.e., a module emulating an infinitereservoir at a variable pressure and temperature). In some embodiments,the initial stage (401) further includes a reservoir flow restrictionmodule (i.e., a module emulating a general pressure drop between thereservoir and the well subsystem). The initial stage (401) may includean input for the reservoir temperature from well data. The initial stage(401) may include various sensors (e.g., mass & energy flow rate sensor,pressure sensor, temperature sensor, etc.) to obtain variousmeasurements (e.g., well temperature, well pressure, mass flow rate,etc.) from a well subsystem to replicate the mass flow rate from thereservoir in normal operating conditions for the well subsystem.

In the physics-based model, the second stage (402) is connected to theinitial stage (401) to simulate components of a well subsystem betweenthe reservoir and the output of the well subsystem. The second stage(402) may include a constant volume chamber (i.e., a module emulatingthe accumulation of mass and energy in a fixed volume) as a midstreamchamber. In some embodiments, the second stage (402) further includes amidstream flow restriction module (i.e., a module emulating a generalpressure drop within the well subsystem). The second stage (402) mayinclude an input for one or more temperatures of components in the wellsubsystem from well data. The second stage (402) may include varioussensors (e.g., mass & energy flow rate sensor, pressure sensor,temperature sensor, etc.) to obtain various measurements (e.g., welltemperature, well pressure, mass flow rate, etc.) from the wellsubsystem to replicate the mass flow rate of the midstream chamber innormal operating conditions for the well subsystem.

In the physics-based model, the connection branch (403) is connected tothe second stage (402) to simulate components of a well subsystembetween the midstream chamber and the well head of the well subsystem.The connection branch (403) may include one or more well check valvemodules that emulate valve and control mechanisms of the well subsystem(e.g., rotary valves, ball valves, linear globe valves, etc.). Theconnection branch (403) may include various sensors (e.g., mass & energyflow rate sensor, pressure sensor, temperature sensor, etc.) to obtainvarious measurements (e.g., well temperature, well pressure, mass flowrate, etc.) from the well subsystem to replicate the mass flow ratebetween the midstream chamber and well head in normal operatingconditions for the well subsystem.

In the physics-based model, the terminal stage (404) is connected to theconnection branch (403) to simulate the well head and output of the wellsubsystem. The terminal stage (404) may include a constant volumechamber (i.e., a module emulating the accumulation of mass and energy ina fixed volume) as the well head. In some embodiments, the terminalstage (404) may further include a well-sand GPU flow restriction module(i.e., a module emulating a general pressure drop between the well headand the output of the well subsystem). The terminal stage (404) mayinclude various sensors (e.g., mass & energy flow rate sensor, pressuresensor, temperature sensor, etc.) to obtain various measurements (e.g.,well temperature, well pressure, mass flow rate, etc.) from the wellsubsystem to replicate the mass flow rate at the well head and the wellsubsystem output in normal operating conditions.

Furthermore, additional modules such as additional valves and thermalresistances may be included throughout the various sections of thephysics-based model to replicate the effects of other well equipment andto simulate heat flow through the well subsystem.

FIG. 5A shows a comparison of a modeled well mass flow determined basedon a physics-based model (501), a predicted well mass flow determined bya physics constrained machine learning model (505), and actual well massflow data (510). The modeled well mass flow data (501) may matchcomponents below a predetermined frequency (e.g., a value of “10” Hz) inthe actual well mass flow data (510). The mismatch between the modeledwell mass flow data (501) and the actual well mass flow data (510) isdue to difficulties in emulating high resolution components and thenonlinear dynamics and of the well mass flow behavior at all frequencies(i.e., above, below, and including the predetermined frequency). On theother hand, the predicted well mass flow data (505) obtained by usingthe Levenberg-Marquardt algorithm and the physics-based model mayemulate the non-linear dynamics and high resolution behavior of actualwell mass flow data (510). For example, the coupling of the actual wellmass flow data (510) and the modeled well mass flow data (501) as inputsto the physics constrained machine learning model may replicate thenoise and/or disturbances related to nonlinear dynamics of the wellsystem of interest.

FIG. 5B shows an example of a well performance comparison of normalizedISE between a physics-based model (525) and a physics constrainedmachine learning model (530). The final normalized ISE related to thephysics constrained machine learning model (530) is 15.59% less than thefinal normalized ISE related to the physics-based model (525) for thewell system of interest (i.e., a normalized ISE improvement of +15.59%).The final ME related to the physics constrained machine learning model(530) has a mean error of 4.78 × 10⁻⁴ kg/s with a standard deviation of0.0599. As a comparison, the final ME related to the physics-based model(525) has a mean error of 55 × 10⁻⁴ kg/s with a standard deviation of0.0649. In other words, the final ME related to the physics constrainedmachine learning model (530) is 91.31% less than the final ME related tothe physics-based model (525) for the well system of interest (i.e., aME improvement of +91.31%).

TABLE 1 shows the results for a physics-based model (525) and a physicsconstrained machine learning model (530) for six different wellsubsystems of a well system of interest. As shown in TABLE 1, in termsof both final normalized ISE and final ME, the physics constrainedmachine learning model (530) consistently outperformed the physics-basedmodel for every well subsystem.

TABLE 1 Well Subsystem Normalized ISE Physics-Based Model Normalized ISEML Model Normalized ISE ML Model Improvement Mean Error Physics-BasedModel Mean Error ML Model Mean Error ML Model Improveme nt 1 1 13.22 +86.88% 0.0207 0.0032 + 84.54% 2 1 17.28 + 82.72% 0.0978 0.0278 + 71.57%3 1 46.51 + 53.49% 0.0879 0.0519 + 40.96% 4 1 84.41 + 15.59% 55x10⁻⁴5.78x10⁻⁴ + 91.31% 6 1 37.51 + 62.49% 0.1419 0.0678 + 52.22% 7 1 35.22 +64.88% 0.0646 0.0304 + 52.94%

FIG. 6 is a block diagram of a computer system (602) used to providecomputational functionalities associated with described algorithms,methods, functions, processes, flows, and procedures according to one ormore embodiments. The illustrated computer (602) is intended toencompass any computing device such as a high performance computing(HPC) device, a server, desktop computer, laptop/notebook computer,wireless data port, smart phone, personal data assistant (PDA), tabletcomputing device, one or more processors within these devices, or anyother suitable processing device, including both physical or virtualinstances (or both) of the computing device. Additionally, the computer(602) may include an input device, such as a keypad, keyboard, touchscreen, or other device that can accept user information, and an outputdevice that conveys information associated with the operation of thecomputer (602), including digital data, visual information, audioinformation, a graphical user interface (GUI), or any combinationthereof.

The computer (602) can serve in a role as a client, network component, aserver, a database or other persistency, or any other component (or acombination of roles) of a computer system for performing the subjectmatter described in the instant disclosure. The illustrated computer(602) is communicably coupled with a network (630). In someimplementations, one or more components of the computer (602) may beconfigured to operate within environments, includingcloud-computing-based, local, global, other environments, or anycombination of environments.

At a high level, the computer (602) is an electronic computing deviceoperable to receive, transmit, process, store, or manage data andinformation associated with the described subject matter. According tosome implementations, the computer (602) may also include or becommunicably coupled with an application server, e-mail server, webserver, caching server, streaming data server, business intelligence(BI) server, or other server (or a combination of servers).

The computer (602) can receive requests over network (630) from a clientapplication (for example, executing on another computer (602)) andresponding to the received requests by processing the said requests inan appropriate software application. In addition, requests may also besent to the computer (602) from internal users (for example, from acommand console or by other appropriate access method), external orthird-parties, other automated applications, as well as any otherappropriate entities, individuals, systems, or computers.

Each of the components of the computer (602) can communicate using asystem bus (603). In some implementations, any or all of the componentsof the computer (602), both hardware or software (or a combination ofhardware and software), may interface with each other and/or theinterface (604) over the system bus (603) using an applicationprogramming interface (API) (612) or a service layer (613), or anycombination thereof. The API (612) may include specifications forroutines, data structures, and object classes. The API (612) may beeither computer-language independent or dependent and refer to acomplete interface, a single function, or even a set of APIs. Theservice layer (613) provides software services to the computer (602) orother components that are communicably coupled to the computer (602).The functionality of the computer (602) may be accessible for allservice consumers using this service layer. Software services, such asthose provided by the service layer (613), provide reusable, definedbusiness functionalities through a defined interface. For example, theinterface may be software written in JAVA, C++, or any other suitablelanguage providing data in extensible markup language (XML) format orany other suitable format. While illustrated as an integrated componentof the computer (602), alternative implementations may illustrate theAPI (612) or the service layer (613) as stand-alone components inrelation to other components of the computer (602) or other componentsof the network (630) that that are communicably coupled to the computer(602). Moreover, any or all parts of the API (612) or the service layer(613) may be implemented as child or sub-modules of another softwaremodule, enterprise application, or hardware module without departingfrom the scope of this disclosure.

The computer (602) includes an interface (604). Although illustrated asa single interface (604) in FIG. 6 , two or more interfaces (604) may beused according to particular needs, desires, or particularimplementations of the computer (602). The interface (604) is used bythe computer (602) for communicating with other systems in a distributedenvironment that are connected to the network (630). Generally, theinterface (604) includes logic encoded in software, hardware, or anycombination thereof and is operable to communicate with the network(630). More specifically, the interface (604) may include softwaresupporting one or more communication protocols associated withcommunications such that the network (630) or interface’s hardware isoperable to communicate physical signals within and outside of theillustrated computer (602).

The computer (602) includes at least one computer processor (605).Although illustrated as a single computer processor (605) in FIG. 6 ,two or more processors may be used according to particular needs,desires, or particular implementations of the computer (602). Generally,the computer processor (605) executes instructions and manipulates datato perform the operations of the computer (602) and any algorithms,methods, functions, processes, flows, and procedures as described in theinstant disclosure.

The computer (602) also includes a memory (606) that holds data for thecomputer (602) or other components (or a combination of both) that canbe connected to the network (630). For example, memory (606) can be adatabase storing data consistent with this disclosure. Althoughillustrated as a single memory (606) in FIG. 6 , two or more memoriesmay be used according to particular needs, desires, or particularimplementations of the computer (602) and the described functionality.While memory (606) is illustrated as an integral component of thecomputer (602), in alternative implementations, memory (606) can beexternal to the computer (602).

The application (607) is an algorithmic software engine providingfunctionality according to particular needs, desires, or particularimplementations of the computer (602), particularly with respect tofunctionality described in this disclosure. For example, application(607) can serve as one or more components, modules, applications, etc.Further, although illustrated as a single module, the application (607)may be implemented as multiple applications (607) on the computer (602).In addition, although illustrated as integral to the computer (602), inalternative implementations, the application (607) can be external tothe computer (602).

There may be any number of computers (602) associated with, or externalto, a computer system containing computer (602), each computer (602)communicating over network (630). Further, the term “client,” “user,”and other appropriate terminology may be used interchangeably asappropriate without departing from the scope of this disclosure.Moreover, this disclosure contemplates that many users may use onecomputer (602), or that one user may use multiple computers (602).

In some embodiments, the computer (602) is implemented as part of acloud computing system. For example, a cloud computing system mayinclude one or more remote servers along with various other cloudcomponents, such as cloud storage units and edge servers. In particular,a cloud computing system may perform one or more computing operationswithout direct active management by a user device or local computersystem. As such, a cloud computing system may have different functionsdistributed over multiple locations from a central server, which may beperformed using one or more Internet connections. More specifically,cloud computing system may operate according to one or more servicemodels, such as infrastructure as a service (IaaS), platform as aservice (PaaS), software as a service (SaaS), mobile “backend” as aservice (MBaaS), serverless computing, artificial intelligence (AI) as aservice (AIaaS), and/or function as a service (FaaS).

Although the disclosure has been described with respect to only alimited number of embodiments, those skilled in the art, having benefitof this disclosure, will appreciate that various other embodiments maybe devised without departing from the scope of the present invention.Accordingly, the scope of the invention should be limited only by theattached claims.

What is claimed is:
 1. A method of managing a well system, comprising:obtaining, by a digital twin manager and based on a predeterminedmonitoring criterion, well mass flow data of the well system; obtaining,by the digital twin manager, modeled well mass flow data for the wellsystem using a physics-based model; training, by the digital twinmanager, a physics constrained machine learning model using one or moremachine learning algorithms based on the well mass flow data and themodeled well mass flow data as inputs; obtaining, by the digital twinmanager, real-time well mass flow data of the well system; outputting,by the digital twin manager, predicted well mass flow data using thereal-time well mass flow data and the trained physics constrainedmachine learning model; and transmitting, by the digital twin manager, acommand to the well system that adjusts a well operation based on thepredicted well mass flow data.
 2. The method of claim 1, wherein thepredicted well mass flow data has higher time resolution than thereal-time well mass flow data from the well system and capturesnon-linear dynamics behavior of the well system, wherein the well systemcomprises interconnected subsystems that include a compressor subsystemand a sales header subsystem.
 3. The method of claim 1, wherein thephysics-based model emulates components of well mass flow behavior ofthe well system that are below a predetermined frequency, and whereinthe physics constrained machine learning model is trained to predictcomponents of the well mass flow behavior of the well system that areabove, below, and include the predetermined frequency.
 4. The method ofclaim 1, wherein the physics constrained machine learning model istrained based on at least six months of the well mass flow data, andwherein the well mass flow data includes data for both normaloperational conditions and shut-down conditions.
 5. The method of claim1: wherein the physics constrained machine learning model is obtainedusing a machine learning algorithm selected from a group consisting of aLevenberg-Marquardt algorithm, a Gauss-Newton algorithm, a steepestdescent algorithm, and an artificial neural network.
 6. The method ofclaim 1: wherein the physics constrained machine learning model uses amisfit function which includes a well mass flow prediction error, andwherein the well mass flow prediction error is selected from a groupconsisting of integral square error (ISE), mean error (ME), normalizedISE, and normalized ME.
 7. A well system, comprising: a well site; aphysics-based modeling server that outputs modeled well mass flow datafor the well site based on a physics-based model; and a digital twinmanager, coupled to the physics-based modeling server and the well site,that includes a processor, wherein the digital twin manager: obtains,based on a predetermined monitoring criterion, well mass flow data ofthe well site; obtains modeled well mass flow data for the well siteusing the physics-based model; trains a physics constrained machinelearning model using one or more machine learning algorithms based onthe well mass flow data and the modeled well mass flow data as inputs;obtains real-time well mass flow data of the well site; outputspredicted well mass flow data using the real-time well mass flow dataand the trained physics constrained machine learning model; andtransmits a command to the well site that adjusts a well operation basedon the predicted well mass flow data.
 8. The well system of claim 7,wherein the predicted well mass flow data has higher time resolutionthan the real-time well mass flow data from the well system and capturesnon-linear dynamics behavior of the well system, wherein the well systemcomprises interconnected subsystems that include a compressor subsystemand a sales header subsystem.
 9. The well system of claim 7, wherein thephysics-based model emulates components of well mass flow behavior ofthe well system that are below a predetermined frequency, and whereinthe physics constrained machine learning model is trained to predictcomponents of the well mass flow behavior of the well system that areabove, below, and include the predetermined frequency.
 10. The wellsystem of claim 7, wherein the physics constrained machine learningmodel is trained based on at least six months of the well mass flowdata, and wherein the well mass flow data includes data for both normaloperational conditions and shut-down conditions.
 11. The well system ofclaim 7: wherein the physics constrained machine learning model isobtained using a machine learning algorithm selected from a groupconsisting of a Levenberg-Marquardt algorithm, a Gauss-Newton algorithm,a steepest descent algorithm, and an artificial neural network.
 12. Thewell system of claim 7: wherein the physics constrained machine learningmodel uses a misfit function which includes a well mass flow predictionerror, and wherein the well mass flow prediction error is selected froma group consisting of integral square error (ISE), mean error (ME),normalized ISE, and normalized ME.
 13. A non-transitory computerreadable medium storing instructions executable by a computer processor,the instructions comprising functionality for: obtaining well mass flowdata of a well system based on a predetermined monitoring criterion;obtaining modeled well mass flow data for the well system using aphysics-based model; training a physics constrained machine learningmodel using one or more machine learning algorithms based on the wellmass flow data and the modeled well mass flow data as inputs; obtainingreal-time well mass flow data of the well system; outputting predictedwell mass flow data using the real-time well mass flow data and thetrained physics constrained machine learning model; and transmitting acommand to the well system that adjusts a well operation based on thepredicted well mass flow data.
 14. The non-transitory computer readablemedium of claim 13, wherein the predicted well mass flow data has highertime resolution than the real-time well mass flow data from the wellsystem and captures non-linear dynamics behavior of the well system,wherein the well system comprises interconnected subsystems that includea compressor subsystem and a sales header subsystem.
 15. Thenon-transitory computer readable medium of claim 13, wherein thephysics-based model emulates components of well mass flow behavior ofthe well system that are below a predetermined frequency, and whereinthe physics constrained machine learning model is trained to predictcomponents of the well mass flow behavior of the well system that areabove, below, and include the predetermined frequency.